#include "stdafx.h"
#include "NiceSpeedBrick.hpp"
#include "../environment/Map.hpp"

namespace actors
{

	NiceSpeedBrick::NiceSpeedBrick() :
		SpeedBrick()
	{

	}

	NiceSpeedBrick::~NiceSpeedBrick()
	{

	}

    void NiceSpeedBrick::cut( const irr::core::vector3df& _posFront, int _ageFront, const irr::core::vector3df& _posBack, int _ageBack )
    {
        NiceSpeedBrick * front = new NiceSpeedBrick( _posFront, m_direction, m_geneticCard );
        front->setAge( _ageFront );
        NiceSpeedBrick * back = new NiceSpeedBrick( _posBack, -m_direction, m_geneticCard );
        back->setAge( _ageBack );

        environment::Map * map = environment::Map::getSingletonPtr();
        map->addSpeedBrick( front );
        map->addSpeedBrick( back );

        boost::shared_ptr< Event::EventNeedGenerikRemove > speedbrickRemove = boost::make_shared< network::packet::RequestNeedGenerikRemove >( SPEEDBRICK, m_id );
        POST_EVENT( speedbrickRemove );
    }
}